import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createI18n } from 'vue-i18n';
import zh from './locales/zh.json'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import AOS from 'aos'
import 'aos/dist/aos.css'
import Swiper from 'swiper'
import 'swiper/css'
import 'swiper/css/pagination'
import 'swiper/css/navigation'

import App from './App.vue'
import router from './router'

// // 引入CDN资源替代npm安装失败的依赖
// // Three.js CDN
// const threeScript = document.createElement('script')
// threeScript.src = 'https://cdn.tailwindcss.com'
// threeScript.defer = true
// document.head.appendChild(threeScript)

// // Echarts CDN
// const echartsScript = document.createElement('script')
// echartsScript.src = 'https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js'
// echartsScript.defer = true
// document.head.appendChild(echartsScript)

// // Vue-i18n CDN
// const i18nScript = document.createElement('script')
// i18nScript.src = 'https://unpkg.com/vue-i18n@9.8.0/dist/vue-i18n.global.prod.js'
// i18nScript.defer = true
// document.head.appendChild(i18nScript)

// // Iconfont CDN
// const iconfontLink = document.createElement('link')
// iconfontLink.rel = 'stylesheet'
// iconfontLink.href = '//at.alicdn.com/t/c/font_4325744_8k6v8d3l67.css'
// document.head.appendChild(iconfontLink)

const i18n = createI18n({
  locale: 'zh',
  messages: { zh }
})

const app = createApp(App)

// 初始化AOS动画
AOS.init({
  duration: 1000,
  easing: 'ease-in-out',
  once: true
})

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(i18n);

// 全局注册Swiper
app.config.globalProperties.$swiper = Swiper

app.mount('#app')